package com.crawler.dao;

import com.alibaba.druid.pool.DruidDataSource;

public class DruidDrive {
	private volatile static DruidDataSource dataSource =  null;
	private DruidDrive(){
	}
	
	public static DruidDataSource getInstence(){
		if(dataSource==null){
			synchronized(DruidDrive.class){
				if(dataSource==null){
					dataSource = new DruidDataSource();
					dataSource.setDriverClassName("com.mysql.jdbc.Driver");
					dataSource.setUsername("root"); 
					dataSource.setPassword("123456");
					dataSource.setUrl("jdbc:mysql://127.0.0.1/book3?useUnicode=true&characterEncoding=utf-8&useSSL=true"); 
					dataSource.setInitialSize(16); 
					dataSource.setMinIdle(1); 
					dataSource.setMaxActive(64);	
					dataSource.setMaxWait(30000);
					dataSource.setMinEvictableIdleTimeMillis(40000);
					dataSource.setPoolPreparedStatements(false);
				}
			}
		}		
		return dataSource;
	}
}
